#pragma once

#include "DiolObject.h"

namespace Diol
{

/*
	Axis

	The Axis object represents a 1-D axis in the DirectInput sense.
	The "stick" of a joystick or gamepad is usually composed of 
	two Axis objects, one for horizontal movements and another for 
	vertical ones.

	Sliders or analog triggers are also reported by DirectInput as Axis
	objects. 

	It's unfortunately not possible to distinguish between a mechanically 
	centered axis and a trigger/slider. 

	An Axis will return its value between a min/max value range (note that 
	as far as I could tell, all the axes I've seen report the value in
	the 0..65535 range).	
*/
class Axis : public Object
{
public:
	Axis( const ObjectInstance& objectInstance, Device* parentDevice );

	LONG					getValue() const		{ return mValue; }
	LONG					getMinValue() const		{ return mMinValue; }
	LONG					getMaxValue() const		{ return mMaxValue; }
	
	virtual std::string		toString() const;
	virtual void			updateFrom( const DIDEVICEOBJECTDATA& entry );
	
protected:
	void					setValue( LONG value );

private:
	LONG	mValue;
	LONG	mMinValue;
	LONG	mMaxValue;
};

}